package com.jojo.jojomall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 魔法少女小夫
 * @Data: 2022/5/14
 * @Version:
 * @Description: redissonConfig配置类
 */
@Configuration
public class MyRedissonConfig {
    @Bean
   public RedissonClient redisson(){
//        第一步创建配置
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer();
        singleServerConfig.setAddress("redis://8.130.105.175:6379");
//        第二步根据config创建出实例，
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;

    }
}
